package objects.fields;

import java.io.IOException;
import java.io.RandomAccessFile;
import objects.DataObject;

public class BooleanVariable extends DataObject {
	public boolean value;

	public BooleanVariable( boolean fromValue ) {
		this.value = fromValue;
		this.gruClass = booleanClass;
	}

	@Override
	public DataObject readValue( RandomAccessFile file ) throws IOException {
		return new BooleanVariable( file.readBoolean() );
	}

	@Override
	public void writeValue( RandomAccessFile file ) throws IOException {
		file.writeBoolean( value );
	}
	
	@Override
	public DataObject newObject() {
		return new BooleanVariable( false );
	}

	@Override
	public String toString() {
		return Boolean.toString( value );
	}
	
	@Override
	public String toCode( String indent ) {
		return String.valueOf( value );
	}
}